package com.wlc.thread.demo02;

import com.wlc.thread.demo05.MyCallAble2;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;

/**
 * @author 王立朝 wanglichao@champion-credit.com
 * @description 使用Callable接口实现多线程
 * @date 2021-09-17 11:57
 */
public class MyCallAble implements Callable<Integer> {

    @Override
    public Integer call() throws Exception {
        System.out.println(Thread.currentThread().getName()+"线程执行中");
        System.out.println("线程执行成功");
        return 1;
    }

    public static void main(String[] args) throws Exception {
        FutureTask<Integer> futureTask = new FutureTask<>(new MyCallAble());
        new Thread(futureTask).start();



    }
}
